package manaul;

import java.util.Random;

import edu.princeton.cs.algs4.StdIn;
import edu.princeton.cs.algs4.StdOut;
import edu.princeton.cs.algs4.StdRandom;

public class C1_35 {

	@SuppressWarnings("deprecation")
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		int SIDES = 6;
		double[] dist = new double[2*SIDES+1];
		for (int i = 1; i <= SIDES; i++)
		for (int j = 1; j <= SIDES; j++)
		dist[i+j] += 1.0;
		for (int k = 2; k <= 2*SIDES; k++)
		dist[k] /= 36.0;
		double te=0;
		for(double q:dist)
			te=te+q;
		StdOut.print(te);
		for(Double po:dist)
		StdOut.printf(" %.3f",po);
		StdOut.println();
		StdOut.print("input N");
		int N=StdIn.readInt();
		double[] real=new double[2*SIDES+1];
		for (int i = 0; i < N; i++) {
			real[2+(int)(Math.random()*6)+(int)(Math.random()*6)]++;
		}
		StdOut.println();
		for (int i = 0; i < real.length; i++) {
			real[i]=real[i]/N;
			StdOut.print(real[i]+" ");
		}
		
		boolean result=true;
		for (int i=2;i<2*SIDES+1;i++)
		{
			if (Math.abs(dist[i]-real[i])>=0.001) {
				result=false;
				break;
			}
		}
		StdOut.print("is accurate? "+result);
		
		//
		private final int day;
		private final int month;
		private final int year;
		
	}
	

}
